package com.zzyl.nursing.mapper;

import java.time.LocalDateTime;
import java.util.List;
import com.zzyl.nursing.domain.ReservationMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.dto.ReservationDto;
import com.zzyl.nursing.vo.TimeCountVo;
import org.apache.ibatis.annotations.*;

/**
 * 预约信息Mapper接口
 * 
 * @author dustin
 * @date 2025-08-29
 */
@Mapper
public interface ReservationMemberMapper extends BaseMapper<ReservationMember>
{
    /**
     * 查询预约信息
     * 
     * @param id 预约信息主键
     * @return 预约信息
     */
    public ReservationMember selectReservationMemberById(Long id);

    /**
     * 查询预约信息列表
     * 
     * @param reservationMember 预约信息
     * @return 预约信息集合
     */
    public List<ReservationMember> selectReservationMemberList(ReservationMember reservationMember);

    /**
     * 新增预约信息
     * 
     * @param reservationMember 预约信息
     * @return 结果
     */
    public int insertReservationMember(ReservationMember reservationMember);

    /**
     * 修改预约信息
     * 
     * @param reservationMember 预约信息
     * @return 结果
     */
    public int updateReservationMember(ReservationMember reservationMember);

    /**
     * 删除预约信息
     * 
     * @param id 预约信息主键
     * @return 结果
     */
    public int deleteReservationMemberById(Long id);

    /**
     * 批量删除预约信息
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteReservationMemberByIds(Long[] ids);

    @Select("select count(1) from reservation where status = 2 and update_by = #{userId} and DATE(update_time)=CURDATE() ")
    Integer cancelledCount(Long userId);

    List<TimeCountVo> countByTime(LocalDateTime time);

    void add(ReservationDto dto);

    List<ReservationMember> getPageList(ReservationMember reservationMember);
    @Update("update reservation set status =2 where id = #{id}")
    void cannel(Long id);
}
